$(document).ready(function(){
	/*显示提示信息*/
	$(".showMessage").hover(mouseenter, mouseleave);
		function mouseenter() {
			$(this).next().removeClass("dsn");
		}
		function mouseleave() {
			$(this).next().addClass("dsn");
		}

	/*显示协议*/
	$(".showAgree").bind("click", function(){		
		$(".bgbox").css("display","block");
		$(".agreeArea").css("display","block");
	});
	/*关闭协议*/
	$(".closeAgree").bind("click", function(){		
		$(".agreeArea").css("display","none");
		$(".bgbox").css("display","none");	
	});

	/*显示删除图标*/
	$(".input").keyup(function(){
			if ($(this).val()!=""){
				$(this).next('.delect').css("display","inline-block");
			}
			else {
				$(this).next('.delect').css("display","none");
			}
	})
	/*删除功能*/
	$(".delect").click(function(){
		$(this).prev().val('');
		$(this).css("display","none");		
	});
	/*银行卡号4位格式*/
	$('.card').keyup(function(){
			var value = $(this).val();
			value = value.replace(/\s/g, '').replace(/(\d{4})(?=\d)/g, "$1 ");
			$(this).val(value);
			val = value;
		});

	/*放大初始化
	new TextMagnifier({
		inputElem: '.inputElem',
		align: 'bottom',
		splitType: [24]
	});*/
	
})

	var code; 
	function createCode(codeId,boxId){
		code = "";  
		var codeLength = 4;//验证码的长度   
		var selectChar = new Array(0,1,2,3,4,5,6,7,8,9,'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z');
		for(var i=0;i<codeLength;i++){     
			var charIndex = Math.floor(Math.random()*36);  
			code += selectChar[charIndex];           
		}    
		if(codeId){  
			codeId.className="code";  
			codeId.innerHTML = code;
			boxId.onselectstart=boxId.oncontextmenu=function(){return(false);};
		}          
	}         
	function validate(){  
		var inputCode = document.getElementById("codeInput").value;
        if(inputCode.length<=0){
			alert("请输入验证码！");  
		}  
		else if(inputCode!=code){  
			alert("验证码输入错误！");  
			createCode();
		}
		else{  
			alert("^-^ OK");  
		}    
	}
	/*获取验证码1min倒计时*/
	var wait=60;
	function time(id){
		if (wait == 0) {
			id.removeAttribute("disabled");
			id.style.color="#007DE3";
			id.style.cursor="pointer";
			id.value="获取验证码";
			wait = 60;
		} 
		else{
			id.setAttribute("disabled", true);
			id.style.color="#999";
			id.style.cursor="wait";
			id.value='重新发送(' + wait + ')';
			wait--;
			setTimeout(function() {
				time(id)
			},
			1000)
		}
	}